/*
{
"状态":1,
"名称":"获取-获取款年季",
"作者":"谌舜谋",
"创建时间":"2018-10-11",
"功能":"获取-获取款年季",
"log": [
	{"date":"" , "dev" :"" , "content" : ""}
]
}
*/
declare @isEdit char(1)='{isEdit}'
declare @title nvarchar(10)='全部'
declare @current_season varchar(50)

if @isEdit='Y'
set @title='请选择'

--计算当季
set @current_season=case  
when DATEPART(MM,GETDATE()) in (2,3,4) then '%春%'
when DATEPART(MM,GETDATE()) in (5,6,7) then '%夏%'
when DATEPART(MM,GETDATE()) in (8,9,10) then '%秋%'
when DATEPART(MM,GETDATE()) in (11,12,1) then '%冬%'
end


select *,case when style_year=DATEPART(YY,GETDATE()-30) and style_year_season like @current_season then 1 else 0 end As current_season  from 
(
	select 0 as  style_year,@title as style_season,@title as style_year_season
	union all 
	select YEAR, Season ,YEAR+Season as style_year_season from DictYear cross join DictSeason 
) A
order by case when style_year=0 then 9999 else style_year end desc,case 
when style_season like '%春%' then 0 
when style_season like '%夏%' then 1 
when style_season like '%秋%' then 2 
when style_season like '%冬%' then 3 else 4 end 


